import 'package:flutter/material.dart';

class ColorWidget extends StatelessWidget {
  const ColorWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Color'),
        centerTitle: true,

        ///255透明度为0（一半透明度 125）
        backgroundColor: Color.fromARGB(125, 255, 0, 0),
      ),
      body: Center(
        child: Column(
          children: [
            Text(
              'Color',
              style: TextStyle(backgroundColor: Color.fromRGBO(255, 0, 0, 0.5)),

              ///0.5半透明
            ),
            Text(
              'Color',
              ///16进制形式
              style: TextStyle(backgroundColor: Color(0xFFFF0000)),

              ///0.5半透明
            ),
          ],
        ),
      ),
    );
  }
}
